#!/usr/bin/python3
# coding=utf-8
# 分析csv文件
import pandas as pd

def split_csv(data):
	'''
	按照wintitle位组逐个分割
	'''
	groups = []
	start = 0
	for i in range(1, len(data)):
		
		if data['wintitle'][i] == data['wintitle'][i-1]:
			continue
		else:
			print("a %s, b %s" %(data['wintitle'][i], data['wintitle'][i-1]))
			end = i - 1
			print("group %d %d" %(start, end))
			groups.append([start, end])
			start = i
	print("group %d %d" %(start, len(data)))
	groups.append([start, len(data)])
			

	return groups
	pass

if __name__ == '__main__':
	data = pd.read_csv("unname.csv")
	groups = split_csv(data)
